import svar
import cv2
import numpy as np
import time

outstream=open("stream.h264","w")

def callback_image(buf):
  m=memoryview(buf)
  outstream.write(m.tobytes())

osdk=svar.load('svar_osdk')

env=osdk.LinuxSetup(True)
vehicle = env.getVehicle()

vehicle.advancedSensing.startH264Stream(osdk.OSDK_CAMERA_POSITION_FPV,callback_image)

#vehicle.advancedSensing.startH264Stream(osdk.OSDK_CAMERA_POSITION_NO_3,callback_image)
#vehicle.advancedSensing.changeH264Source(osdk.OSDK_CAMERA_POSITION_NO_3,osdk.OSDK_CAMERA_SOURCE_H20T_ZOOM)

time.sleep(10)

